<title>套餐列表</title>
<div class="layui-fluid">
    <div class="layui-col-md12">
        <form class="layui-form layui-col-md11">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input name="searchName" placeholder="请输入名称" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-inline">
                    <a class="layui-btn" lay-submit lay-filter="find">查询</a>
                </div>
                <div class="layui-input-inline">
                    <select name="searchType" id="searchType" lay-filter="searchType">
                        <option value="">全部</option>
                        <option value="1">短信</option>
                        <option value="2">订单</option>
                        <option value="5">组合</option>
                        <!--<option value="3">流量</option>-->
                    </select>
                </div>
            </div>
        </form>
        <a class="layui-btn layui-col-md1" lay-submit lay-filter="showAdd">新增</a>
    </div>
    <!--弹出层-->
    <form class="layui-form" style='display:none;' id="add_edit_form">
        <div class="layui-form-item">
            <label class="layui-form-label">套餐名称</label>
            <div class="layui-input-inline">
                <input name="name" required lay-verify="required" placeholder="请输入套餐名称" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">套餐图片</label>
            <div class="layui-input-block">
					<span class="layui-col-md12" style="position:relative; display:block;">
						<a class="layui-btn layui-col-md4">上传</a>
						<input id="addImgPut" type="file">
					</span>
                <img id="image">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">套餐类型</label>
            <div class="layui-input-block">
                <input lay-filter="type" type="radio" name="type" value="1" title="短信" checked/>
                <input lay-filter="type" type="radio" name="type" value="2" title="订单"/>
                <input lay-filter="type" type="radio" name="type" value="5" title="组合"/>
            </div>
        </div>
        <div class="layui-form-item number sms_number">
            <label class="layui-form-label">短信数量</label>
            <div class="layui-input-inline">
                <input name="sms_number" value="0" placeholder="请输入短信数量" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item number order_number" style="display: none;">
            <label class="layui-form-label">订单数量</label>
            <div class="layui-input-inline">
                <input name="order_number" value="0" placeholder="请输入短信数量" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">套餐金额</label>
            <div class="layui-input-inline">
                <input name="money" required lay-verify="required|number" placeholder="请输入套餐金额" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">可购买次数</label>
            <div class="layui-input-inline">
                <input name="number" value="0" required lay-verify="required|number" placeholder="请输入套餐数量" class="layui-input">
            </div>
            <div class="layui-input-inline">
                0代表不限次数
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">有效期（月）</label>
            <div class="layui-input-inline">
                <input name="validity_time" required lay-verify="required|number" placeholder="请输入有效期" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">详细说明</label>
            <div class="layui-input-inline">
                <textarea name="detail_info" placeholder="请输入详细说明" required lay-verify="required" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="checkbox" name="status" checked lay-skin="switch" lay-text="开启|关闭">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <a class="layui-btn" id="btn" lay-submit lay-filter="sub">提交</a>
            </div>
        </div>
    </form>
    <!--数据表格-->
    <div class="layui-col-md12">
        <table id="pageTable" lay-filter="pageTable" lay-data="{id: 'pageTable'}">
        </table>
    </div>
</div>
<!--添加/编辑签名-->
<script type="text/javascript">
    layui.use('setMeal/list', layui.factory('setMeal/list'));
</script>
<script type="text/html" id="operations">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
</script>
<!--图片模板-->
<script type="text/html" id="imgTpl">
    <img class="layui-upload-img pic_url" style="width:40px; height:40px"
         src={{ d.pic_url }}>
</script>
<!--状态码模板-->
<script type="text/html" id="statusTpl">
    <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="status" {{
           d.status== 1 ? 'checked' : '' }}>
</script>

<style>
    /*列表展示图片时需要添加*/
    .layui-table-cell {
        height: auto;
    }

    #add_edit_form {
        margin-top: 20px;
        margin-right: 20px;
    }

    #image {
        height: 200px;
        width: 200px;
        margin-top: 10px;
        border: 1px solid #e5e5e5;
    }

    input[id=addImgPut] {
        border: 0px solid red;
        position: absolute;
        left: 0px;
        top: 0px;
        opacity: 0;
        height: 36px;
        width: 200px;
    }

    input[id=addImgPut] :hover {
        cursor: pointer;
    }
</style>
